//
//  SubViewpointTVCell.m
//  WildDonkey
//
//  Created by 佟小波 on 15/3/30.
//  Copyright (c) 2015年 lanou. All rights reserved.
//

#import "SubViewpointTVCell.h"
#import "ViewPoint.h"

@implementation SubViewpointTVCell

- (void)dealloc
{
    [_telLabel release];
    [_opentimeLabel release];
    [_addressLabel release];
    [_descLabel release];
    [_viewPoint release];
    [super dealloc];
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self=[super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        CGRect rect = [UIScreen mainScreen].bounds;
        
        CGFloat width = rect.size.width;
        CGFloat height=rect.size.height;
        
        _telLabel=[[UILabel alloc] initWithFrame:CGRectMake(18, 10, width-20, 30)];
//        _telLabel.backgroundColor=[UIColor brownColor];
        _telLabel.font=[UIFont systemFontOfSize:16];
        [self.contentView addSubview:_telLabel];
        
        _opentimeLabel=[[UILabel alloc] initWithFrame:CGRectMake(18, 50, width-20, 30)];
//        _opentimeLabel.backgroundColor=[UIColor blueColor];
        [self.contentView addSubview:_opentimeLabel];
        
        _addressLabel=[[UILabel alloc] initWithFrame:CGRectMake(18, 90, width-20, 50)];
//        _addressLabel.backgroundColor=[UIColor purpleColor];
        _addressLabel.numberOfLines=0;
        [self.contentView addSubview:_addressLabel];
        
        _typeLabel=[[UILabel alloc] initWithFrame:CGRectMake(18, 150, width-20, 30)];
//        _descLabel.backgroundColor=[UIColor blueColor];
        [self.contentView addSubview:_typeLabel];
        
    }
    return self;
}


- (void)setViewPoint:(ViewPoint *)viewPoint
{
    if (_viewPoint!=viewPoint) {
        [_viewPoint release];
        _viewPoint=[viewPoint retain];
        
        _telLabel.text=[NSString stringWithFormat:@"电话:  %@",_viewPoint.telephone];
        
        _opentimeLabel.text=[NSString stringWithFormat:@"开放时间: %@",_viewPoint.opentime];
        
        _addressLabel.text=[NSString stringWithFormat:@"地址: %@",_viewPoint.address];
        
        _typeLabel.text=[NSString stringWithFormat:@"类型: %@",_viewPoint.type];
        
        
    }
}


@end
